package com.qvtu.springboot.mapper;

import com.qvtu.springboot.entity.Employee;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface EmployeeMapper {

    @Select("select * from employee")
    List<Employee> selectAll();

    @Select("select * from employee where id=#{id}")
    Employee selectById(Integer id);

    //    @Insert("insert into `employee` (name,sex,no,age,description,department_id)" +
//        "values (#{name},#{sex},#{no},#{age},#{description},#{departmentId})")
//    void add(Employee employee);
    @Insert("insert into `employee` (name,sex,no,age,description,department_id)" +
            "values (#{name},#{sex},#{no},#{age},#{description},#{departmentId})")
    void add(Employee employee);

    @Delete("delete from `employee` where id=#{id}")
    void deleteById(Integer id);

    @Update("update `employee` set name=#{name},sex=#{sex},age=#{age},description=#{description},department_id=#{departmentId} where id=#{id}")
    void update(Employee employee);
}
